<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title>Processing.js test of xmlElement equals()</title>
	<script type="text/javascript" src="../../../processing.js"></script> 
</head>
<body>
  <h1>XMLElement Test for Equality</h1>

  <h3>Source</h3>
<pre>  String xmlstring1 = "&lt;xml test='monkey'&gt;lalalas&lt;b&gt;moobles&lt;/b&gt;ginger beer&lt;/xml&gt;";
  String xmlstring2 = "&lt;xml test='monkey'&gt;lalalas&lt;b&gt;moobles&lt;/b&gt;ginger beeeer&lt;/xml&gt;";
  XMLElement xml1 = new XMLElement(xmlstring1);
  XMLElement xml2 = new XMLElement(xmlstring2);
  println("[original]\n"+xml1);
  println("[reference]\n"+xml2);
  println("original.toString().equals(reference.toString())? (should be false) " + xml1.toString().equals(xml2.toString()));
  println("original.equals(reference)? (should be false) " + xml1.equals(xml2));
  xml2 = new XMLElement(xmlstring1);
  println("[reference]\n"+xml2);
  println("original.toString().equals(reference.toString())? (should be true) " + xml1.toString().equals(xml2.toString()));
  println("original.equals(reference)? (should be true) " + xml1.equals(xml2));
  xml2 = new XMLElement(xml1.toString());
  println("original.equals(new XMLElement(original.toString()))? (should be true) " + xml1.equals(xml2));
</pre>

	<script id="script" type="application/processing">
    String xmlstring1 = "<xml test='monkey'>lalalas<b>moobles</b>ginger beer</xml>";
    String xmlstring2 = "<xml test='monkey'>lalalas<b>moobles</b>ginger beeeer</xml>";
    XMLElement xml1 = new XMLElement(xmlstring1);
    XMLElement xml2 = new XMLElement(xmlstring2);
    println("[original]\n"+xml1);
    println("[reference]\n"+xml2);
    println("original.toString().equals(reference.toString())? (should be false) " + xml1.toString().equals(xml2.toString()));
    println("original.equals(reference)? (should be false) " + xml1.equals(xml2));
    xml2 = new XMLElement(xmlstring1);
    println("[reference]\n"+xml2);
    println("original.toString().equals(reference.toString())? (should be true) " + xml1.toString().equals(xml2.toString()));
    println("original.equals(reference)? (should be true) " + xml1.equals(xml2));
    xml2 = new XMLElement(xml1.toString());
    println("original.equals(new XMLElement(original.toString()))? (should be true) " + xml1.equals(xml2));
	</script>
  <canvas id="display"></canvas>

</body>
</html>

